﻿<UserControl x:Class="DiscoveryLogic.Analytics.Modules.ImportRules.ImportRuleEditor"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Controls="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"
    xmlns:Forms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
    Height="Auto" Width="Auto" MinWidth="350" Loaded="UserControl_Loaded">
    <UserControl.Resources>
    </UserControl.Resources>
    <Border CornerRadius="10">
        <DockPanel LastChildFill="True">
            <StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom" HorizontalAlignment="Stretch">
                <Button x:Name="btnCancel" Content="Cancel" HorizontalAlignment="Right" Margin="15" Width="50" Click="btnCancel_Click"/>
                <Button x:Name="btnOK" Content="OK" HorizontalAlignment="Right" Margin="15" Width="50" Click="btnOK_Click" />
            </StackPanel>
            <Grid Margin="12" DockPanel.Dock="Top">
                <Grid.RowDefinitions>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="70"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="45"/>
                </Grid.ColumnDefinitions>
                
                <Label Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left">Source type:</Label>
                <StackPanel Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" Orientation="Horizontal">
                    <RadioButton 
                        Grid.Row="0" Grid.Column="1" x:Name="rdExcel" 
                        Checked="rdExcel_Checked"
                        VerticalAlignment="Center" HorizontalAlignment="Left" 
                        Content="Excel" IsChecked="True" Margin="0,0,10,0"/>
                    <RadioButton 
                        Grid.Row="0" Grid.Column="1" x:Name="rdDB" 
                        Checked="rdDB_Checked"
                        VerticalAlignment="Center" HorizontalAlignment="Left" 
                        Content="DB" IsChecked="False" Margin="0,0,10,0"/>
                    <RadioButton 
                        Grid.Row="0" Grid.Column="1" x:Name="rdXml" 
                        Checked="rdXml_Checked"
                        VerticalAlignment="Center" HorizontalAlignment="Left" 
                        Content="Xml" IsChecked="False" Margin="0,0,10,0"/>
                </StackPanel>
                
                <Label 
                    Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" 
                    HorizontalAlignment="Left">Rule name:</Label>
                <TextBox Grid.Row="1" Grid.Column="1" Margin="3" x:Name="txtRuleName"></TextBox>
                
                <Label 
                    Grid.Row="2" Grid.Column="0" x:Name="lblSrcPath"
                    VerticalAlignment="Center" HorizontalAlignment="Left">Source file:</Label>
                <TextBox Grid.Row="2" Grid.Column="1" x:Name="txtFilePath" Margin="3"></TextBox>
                <Button Grid.Row="2" Grid.Column="2" x:Name="btnBrowse" Content="Browse.." Height="25" VerticalAlignment="Center" Click="btnBrowse_Click" />
                
                <Label 
                    Grid.Row="3" Grid.Column="0" x:Name="lblRecordPath"
                    VerticalAlignment="Center" HorizontalAlignment="Left">Worksheet:</Label>
                <ComboBox 
                    Grid.Row="3" Grid.Column="1" x:Name="cboWorksheets" 
                    Margin="3" SelectionChanged="cboWorksheets_SelectionChanged" />
                
                <Label Grid.Row="4" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left">Entity type:</Label>
                <ComboBox Grid.Row="4" Grid.Column="1" x:Name="cboEntityType" Margin="3" SelectionChanged="cboEntityType_SelectionChanged"/>
                
            </Grid>
            <!--<Controls:DataGrid x:Name="dgFieldMappings" Margin="4" MinHeight="100">
                <Controls:DataGrid.Columns>
                    <Controls:DataGridTextColumn Header="Entity field" Width="130"/>
                    <Controls:DataGridComboBoxColumn 
                        x:Name="dcSrcFields" Header="Source field" Width="200"
                        ItemsSource="{Binding SrcFields}"/>
                </Controls:DataGrid.Columns>
            </Controls:DataGrid>
            <DataGrid:DataGridControl x:Name="dgcBindings">
                <DataGrid:DataGridControl.View>
                    <Views:TableView/>
                </DataGrid:DataGridControl.View>
                <DataGrid:DataGridControl.Columns>
                    <DataGrid:Column FieldName="PropName" Title="Required field"/>
                    <DataGrid:Column FieldName="SrcFieldName" Title="Src field" CellEditor="{StaticResource SrcFieldEditor}"/>
                </DataGrid:DataGridControl.Columns>
            </DataGrid:DataGridControl>-->
            <WindowsFormsHost Margin="4" MinHeight="100" Background="White">
                <Forms:DataGridView x:Name="dvBindings" Location="0,0" Width="300" Height="400">
                    <Forms:DataGridView.Columns>
                        <Forms:DataGridViewTextBoxColumn HeaderText="Required field" Width="120"/>
                        <Forms:DataGridViewComboBoxColumn HeaderText="Source field" Width="200"/>
                    </Forms:DataGridView.Columns>
                </Forms:DataGridView>
            </WindowsFormsHost>
        </DockPanel>
    </Border>
</UserControl>
